<%@include file="/WEB-INF/JSP-Files/headline.jsp" %>
<%@page import="java.util.ArrayList, model.Course, model.Session, model.User, servlets.AServlet"%>
<%@page import="database.DBHandler"%>
<%@page import="java.sql.Connection"%>
<div id="content">
<div id="wrapper">
<%	Connection  con = DBHandler.getHandler().getLocalCon();
	User user = DBHandler.getHandler().getUser((String)request.getSession().getAttribute("LoginName"), con);
	AServlet.finishTransaction(con, false);
	DBHandler.getHandler().returnLocalCon(con);%>
<% if (request.getSession(true).getAttribute("DetailsUpdateError") != null){ %>
		<span class="errorMessage"><%= request.getSession(true).getAttribute("DetailsUpdateError").toString() %></span>
		<% request.getSession(true).removeAttribute("DetailsUpdateError");
} %>

<form id="userDetails" action="/skiryanoandspuzir/Users" method="post" onsubmit="javascript:return isValidPhone(this.elements['regPhone'].value,'Please input a valid phone number');">
	<table>
	<tr>
		<td><b>User Name</b></td><td><%=user.getUserName() %></td>
	</tr>
	<tr>
		<td><b>Password</b></td><td><%=user.getPassword() %></td><td><input type="text" name="password" id="regPassword" /></td>
	</tr>
	<tr>
		<td><b>Name</b></td><td><%=user.getName() %></td><td><input type="text" name="name" id="regName" /></td>
	</tr>
	<tr>
		<td><b>Family</b></td><td><%=user.getFamily() %></td><td><input type="text" name="family" id="regFamily" /></td>
	</tr>
	<tr>
		<td><b>Phone</b></td><td><%=user.getPhone() %></td><td><input type="text" name="phone" id="regPhone" /></td>
	</tr>
	<tr>
		<td><b>Is Admin</b></td><td><%=user.isAdmin()? "yes":"no" %></td>
	</tr>
	<tr>
		<td><input type="submit" value="Update" name="updateDetails" /></td><td></td>
	</tr>
	</table>
</form>
</div>
</div>
</body>
</html>